{% extends "base.html" %}
{% block naiv %}{% endblock naiv%}
{% block media %}
<script type="text/javascript">
$(document).ready(function(){ 
	var msg = "{{ msg }}";
	if (msg != ""){
		alert(msg);
	}
	$("form[action='/regist']").submit(function(){
		if($("#regUser").val()==''){
			alert('用户名不能为空!');
			return false;
		}else if($("#regPwd").val()==''){
			alert('密码不能为空!');
			return false;
		}else if($("#regRePwd").val()==''){
			alert('重复密码不能为空!');
			return false;
		}else if($("#regPwd").val()!=$("#regRePwd").val()){
			alert('2次密码输入不一致,请重试!');
			return false;
		}else{
			return true;
		}
		return false;
	});
	$("form[action='/login']").submit(function(){
		if($("#lgnUser").val()==''){
			alert('用户名不能为空!');
			return false;
		}else if($("#lgnPwd").val()==''){
			alert('密码不能为空!');
			return false;
		}else{
			return true;
		}
		return false;
	});
});
</script>
{% endblock media%}
{% block left %}
<h2>注册</h2>
<form action="/regist" method="post">
<table>
	<tr>
		<td>用户名</td>
		<td><input id="regUser" type="text" name="username"/></td>
	</tr>
	<tr>
		<td>登录密码</td>
		<td><input id="regPwd" type="password" name="password"/></td>
	</tr>
	<tr>
		<td>确认密码</td>
		<td><input id="regRePwd" type="password" name="repassword"/></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" value="注册"/></td>
	</tr>
</table>
</form>
{% endblock left %}
{% block right %}
<h2>登录</h2>
<form action="/login" method="post">
<table>
	<tr>
		<td>用户名</td>
		<td><input id="lgnUser" type="text" name="username"/></td>
	</tr>
	<tr>
		<td>登录密码</td>
		<td><input id="lgnPwd" type="password" name="password"/></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" value="登录"/></td>
	</tr>
</table>
</form>
{% endblock right %}
	  
  